<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数学公式</title>
    <!-- <script src="./mathjs/text-chtml.js"></script> -->
    <!-- <script src="./mathjs2/tex-mml-chtml.js"></script> -->
    <!-- <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML-full"></script> -->
     <script src="https://static.yxuer.com/MathJax-3.0.5/es5/tex-mml-chtml.js"></script>
   
</head>
<body>

    <div id="box"> 数学公式 
        <!-- <span>
            段内公式示例：
                \[ x = {-b \pm \sqrt{b^2-4ac} \over 2a} \]
        </span> -->
        <span class="contentSpan">
            <!-- 行内公式示例：当 $$a \ne 0$$ 时，有 $$ax^2 + bx + c = 0$$ 的解是 $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$。 -->
        </span>
    </div>


    <script type="module">
        //import {marked} from './markd.js'
       
        //window.MathJax.typesetPromise && window.MathJax.typesetPromise([])
        //window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub])
        if(window.MathJax ) window.MathJax.typeset()

       let box = document.getElementById('box')
       let contentSpan = document.querySelector('.contentSpan')
     
       let content = ''
       let str = `#好的以下是一些数学公式;## 非常高兴为你服务.行内公式示例：当 $$a \ne 0$$ 时，有 $$ax^2 + bx + c = 0$$ 的解是 $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$。`
       let arr = str.split('')

       init()
       //renderContent()
       function renderContent() {
        setTimeout(()=> {
            const div = document.createElement('div')
            div.innerHTML = str
            window.MathJax.typesetPromise()
        },2000)
      } 

       function init() {
          setTimeout(()=> {
            let chart = arr.shift()
            content+=chart
            contentSpan.innerHTML = content
            window.MathJax.typesetPromise()
            
            //window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub])
            //console.log(content)
            if(arr.length) init()
          
          },30)
          //window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub,document.getElementById('box')])
          
          
       }


    
    </script>
    
</body>
</html>